<?php
/*
 * @Author: 李明
 * @Date: 2021-08-24 11:59:43
 * @LastEditTime: 2021-11-30 18:06:22
 * @LastEditors: 李明
 * @Description: 
 * @FilePath: /CRM2.0-PHP/app/Models/UserWorker.php
 * @山东壹零贰肆信息科技有限公司
 */

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

/**
 * Class UserWorker
 * 
 * @property int $id
 * @property int|null $user_id
 * @property int|null $worker_id
 * @property int|null $old_worker_id
 * @property int|null $state
 * @property string|null $remark
 * @property Carbon|null $create_time
 * @property Carbon|null $update_time
 * 
 * @property User|null $user
 * @property Worker|null $worker
 *
 * @package App\Models
 */
class UserWorker extends Model
{
    protected $table = 'user_worker';

    protected $casts = [
        'user_id' => 'int',
        'worker_id' => 'int',
        'old_worker_id' => 'int',
        'state' => 'int'
    ];

    protected $fillable = [
        'user_id',
        'worker_id',
        'old_worker_id',
        'state',
        'remark'
    ];

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function worker()
    {
        return $this->belongsTo(Worker::class);
    }
}
